//
//  SocketMethod.h
//  TengyunStation
//
//  Created by Johnny on 15/8/21.
//  Copyright (c) 2015年 xingrong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "NSString+Category.h"

@interface SocketMethod : NSObject

//报文头文件
+ (NSData *)socketHeadDataMethod:(NSString *)method;

//计算crc16校验码
+ (NSData *)getCRC16WithData:(NSData *)data;

//Data转长度
+ (int)getLengthWithData:(NSData *)data;

//根据报文长度返回16进制长度数据
+ (NSData *)hexDataWithLength:(NSInteger)length;

//报文前置加两次16进制
+ (NSData *)doubleHexEncryptMessageData:(NSData *)data;

//报文解一次16进制
+ (NSData *)messageDataDecryptHexData:(NSData *)data;

//nsdata转字符串
+ (NSString *)stringData:(NSData *)data;

//前置一次16进制data转字符串
+ (NSString *)stringDecryHexData:(NSData *)data;


+ (NSString *)stringDecryHexData:(NSData *)data Range:(NSRange)range;

//nsdata截取返回长度
+ (NSInteger)integerSubdata:(NSData *)data Range:(NSRange)range;

//nsdata截取返回字符串
+ (NSString *)stringSubdata:(NSData *)data Range:(NSRange)range;

//数组取值返回字符串
+ (NSString *)subArray:(NSArray *)array Index:(NSInteger)index;

//获取本月的年月
+ (NSString *)getThisMonTypeyyyyMM;

//获取上个月的年月
+ (NSString *)getLastMonTypeyyyyMM;

//快递状态
+ (NSString *)expressType:(NSString *)type;

//转字节时检测数据是否为nil
+ (const char *)checkLegal:(NSString *)string;

//检测字符串是否为空
+ (NSString *)checkNull:(NSString *)string;

//时间yyyyMMddHHmmss转yyyy-MM-dd HH:mm:ss
+ (NSString *)dateStringWithDateString:(NSString *)string;

+ (NSString *)getSocketVersion;

@end

